// pages/me/me.ts
import methods from '../../utils/methods'
const app = getApp();
import {store} from '../../store/index';
import http from '../../utils/http';
Page({
  $data: [
    'userinfo',
    'isLogin'
  ],
  data: {

  },
  ...methods,
  logout() {
    const _this = this
    wx.showModal({
      title: '提示',
      content: '确认退出登陆吗',
      success(res) {
        if (res.confirm) {
          console.log(_this.output());
          wx.clearStorageSync()
          store.commit('clear')
        } else {

        }
      }
    })
  },
  output(){
    http.post("/logout/").then((res) => {
      console.log(res);
    })
  },
  onShow() {
    if (typeof this.getTabBar === 'function' &&
      this.getTabBar()) {
      this.getTabBar().setData({
        //唯一标识（其它设置不同的整数）  
        selected: 2
      })
    }
  },
  onLoad(){
    console.log(this);
    // this.getInfo()
  },

  // 测试用
  // getInfo(){
  //   http.post("/info/").then((res) => {
  //     console.log(res);
  //   })
  // },
})